'\" te
.TH memcached 1M "March 2008" "SunOS 5.11" "Administration Commands"
.SH NAME
memcached \- high performance memory object caching
system
.SH SYNOPSIS
.LP
.nf
\fBmemcached [\fB-l\fR \fI<ip-addr>\fR] [\fB-d\fR] [\fB-u\fR \fI<username>\fR]
[\fB-m\fR \fI<num>\fR] [\fB-c\fR \fI<num>\fR] [\fB-k\fR] [\fB-L \fR]
[\fB-p\fR \fI<num>\fR] [\fB-U\fR \fI<num>\fR] [\fB-s\fR \fI<filename>\fR]
[\fB-a\fR \fI<perms>\fR] [\fB-M\fR] [\fB-r\fR] [\fB-b\fR]
[\fB-f\fR \fI<factor>\fR] [\fB-n\fR \fI<size>\fR] [\fB-h\fR] [\fB-v\fR] [\fB-vv\fR] [\fB-i\fR]
[\fB-P\fR \fI<filename>\fR] [\fB-t\fR \fI<threads>\fR] [\fB-D\fR \fI<char>\fR]\fR
.fi

.SH DESCRIPTION
.sp
.LP
\fBmemcached\fR is a flexible memory object caching daemon
designed to alleviate database load in dynamic web applications by storing
objects in memory.  It is based on \fBlibevent\fR to scale to
any size needed, and is specifically optimized to avoid swapping and always
use non-blocking I/O. This man page documents briefly the \fBmemcached\fR memory
object caching daemon.
.SH OPTIONS
.sp
.LP
The options supported by the \fBmemcached\fR command are
described below.
.sp
.ne 2
.mk
.na
\fB\fB-l\fR \fI<ip-addr>\fR\fR
.ad
.RS 17n
.rt  
Listen on \fI<ip-addr>\fR; default
to \fBINADDR_ANY\fR. This is an important option to  consider
as there is no other way to secure the installation. Binding to an  internal
or fire walled network interface is suggested.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-d\fR\fR
.ad
.RS 17n
.rt  
Run memcached as a daemon.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-u\fR \fI<username>\fR\fR
.ad
.RS 17n
.rt  
Assume the identity of \fI<username>\fR only when run as a super user (root).
.RE

.sp
.ne 2
.mk
.na
\fB\fB-m\fR \fI<num>\fR\fR
.ad
.RS 17n
.rt  
Use the maximum \fI<num>\fR MB memory for object storage; the default is 64 MB.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-c\fR \fI<num>\fR\fR
.ad
.RS 17n
.rt  
Use the specified number of maximum simultaneous connections;
the default is 1024.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-k\fR\fR
.ad
.RS 17n
.rt  
Lock down all paged memory.
.sp
Use this option with caution with large caches. For information about
the configuration suggestions, see the README and the memcached home page.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-L\fR\fR
.ad
.RS 17n
.rt  
Preallocate memory and use large memory pages if possible.
.sp
This option will preallocate cache memory for object storage.
See description of \fB-m\fR option for a specification of the size of the memory.
If supported by the platform, large memory pages will be allocated.
This should reduce number of TLB misses and increase performance.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-p\fR \fI<num>\fR\fR
.ad
.RS 17n
.rt  
Listen on the TCP port \fI<num>\fR\&.
The default port is 11211. 
.RE

.sp
.ne 2
.mk
.na
\fB\fB-U\fR \fI<num>\fR\fR
.ad
.RS 17n
.rt  
Listen on the UDP port \fI<num>\fR\&.
The default is 0, meaning that the UDP protocol is disabled.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-s\fR \fI<filename>\fR\fR
.ad
.RS 17n
.rt  
Unix socket path to listen on (disables listening support for TCP and UDP).
.RE

.sp
.ne 2
.mk
.na
\fB\fB-a\fR \fI<perms>\fR\fR
.ad
.RS 17n
.rt  
Permissions (in octal format) for Unix socket created with \fB-s\fR option.
Default value is 0700.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-M\fR\fR
.ad
.RS 17n
.rt  
Disable automatic removal of items from the cache when out
of memory. Additions will not be possible until adequate space is freed up.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-r\fR\fR
.ad
.RS 17n
.rt  
Raise the core file size limit to the maximum allowable.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-b\fR\fR
.ad
.RS 17n
.rt  
Run a managed instance.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-f\fR \fI<factor>\fR\fR
.ad
.RS 17n
.rt  
Use this option to specify \fI<factor>\fR as
the multiplier for computing the sizes of memory chunks that items are stored
in. A lower value may result in less wasted memory depending on the total
amount of memory available and the distribution of item sizes. The default
value is 1.25.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-n\fR \fI<size>\fR\fR
.ad
.RS 17n
.rt  
Allocate a minimum of \fI<size>\fR bytes
for the item key, value, and flags. The default value is 48. If you have a
lot of small keys and values, you can get a significant memory efficiency
gain with a lower value. If you use a high chunk growth factor, that is \fB-f\fR option, you may want to increase the size to allow a bigger percentage
of your items to fit in the most densely packed smallest chunks.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-h\fR\fR
.ad
.RS 17n
.rt  
Show the version of memcached and a summary of options.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-v\fR\fR
.ad
.RS 17n
.rt  
Be verbose during the event loop; print out errors and warnings.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-vv\fR\fR
.ad
.RS 17n
.rt  
Be even more verbose; same as \fB-v\fR option but
also print client commands and  responses.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-i\fR\fR
.ad
.RS 17n
.rt  
Display \fBmemcached\fR and \fBlibevent\fR licenses.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-P\fR \fI<filename>\fR\fR
.ad
.RS 17n
.rt  
Print \fBpidfile\fR to the specified file.
.LP
Note - 
.sp
.RS 2
This option can be used only when \fBmechached\fR is
run as a daemon (\fB-d\fR option).
.RE
.RE

.sp
.ne 2
.mk
.na
\fB\fB-t\fR \fI<threads>\fR\fR
.ad
.RS 17n
.rt  
Number of threads to use to process incoming requests. The default is 4.
It is typically not useful to set this much higher than the number of CPU cores
on the \fBmemcached\fR server.
.RE

.sp
.ne 2
.mk
.na
\fB\fB-D\fR \fI<char>\fR\fR
.ad
.RS 17n
.rt  
Use the \fI<char>\fR as the delimiter
between key prefixes and IDs. This is used for per-prefix statistics reporting.
The default is \fB:\fR (colon). If this option is specified,
statistics collection is turned on automatically; if not, then it can be turned
on by sending the \fBstats detail on\fR command to the server.
.RE

.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.mk
.na
\fB\fB0\fR\fR
.ad
.RS 5n
.rt  
command executed successfully
.RE

.sp
.ne 2
.mk
.na
\fB\fB1\fR\fR
.ad
.RS 5n
.rt  
error in executing the command
.RE

.SH SERVICE MANAGEMENT FACILITY
.sp
.LP
\fBmemcached\fR package for Solaris (\fBservice/memcached\fR)
includes files necessary to register with the Service Management Facility
described in \fISMF(5)\fR. The following procedure describes the steps to automate
the service management using memcached.
.RS +4
.TP
1.
Add other parameters to be passed to the memcached service instance.
.sp
example: specify the server to use 1024 MB of memory
.sp
.in +2
.nf
example% svccfg
svc:> select memcached
svc:/application/database/memcached> setprop memcached/options=("-m" "1024")
svc:/application/database/memcached> quit
example% svcadm refresh memcached
.fi
.in -2

.LP
Note - 
.sp
.RS 2
The arguments cannot be passed as a single string because of a limitation in \fIsvccfg\fR.
.RE
.RE
.RS +4
.TP
2.
Enable memcached .
.sp
.in +2
.nf
example% svcadm enable memcached 
.fi
.in -2

The state of the service instance changes to \fBonline\fR,
and the memcached service instance must be started:
.sp
.in +2
.nf
example% svcs memcached
STATE          STIME    FMRI
online          1:19:15 svc:/application/database/memcached:default
.fi
.in -2
.sp

.RE
.RS +4
.TP
3.
To disable shutdown and automatic restart of memcached service instance,
.sp
.in +2
.nf
example% svcadm disable memcached
.fi
.in -2

.RE
.SH USER AUTHORIZATIONS
.sp
.LP
You can use \fBRBAC(5)\fR to authorize otherwise non-privileged users to manage
\fBmemcached\fR services.
To let a user named \fBmyuser\fR change \fBmemcached\fR value properties and
manage \fBmemcached\fR service states, add the following line to
\fB/etc/user_attr\fR:
.sp
.in +2
.nf
myuser::::type=role;profiles=Memcached Administration,All
.fi
.in -2
.sp
.RE
.SH PACKAGE CONTENTS
.sp
.LP
The \fBmemcached\fR package consists of the memcached server and
man pages for the server. 
.sp
.LP
Client libraries can be made available by installing other packages.
.sp
.LP
The memcached server is based on the memcached open-source software
available from http://www.danga.com/memcached/\&.
.SH SECURITY
.sp
.LP
When the memcached server is started, it listens for network requests
on a TCP port and/or a UDP port. It is important for the security of the network
that you protect this port, for example, by blocking access to this port in
a firewall. 
.sp
.LP
The default TCP port number to use is 11211. 
.sp
.LP
You may use the \fB-p\fR option to set another TCP port number.
There is no default UDP port number. You can use the \fB-U\fR option
to set a UDP port number.
.sp
.LP
If you are running memcached on a server with multiple network interfaces,
you can restrict vulnerability by binding memcached to a single interface
by using the \fB-l\fR option.
.LP
Caution - 
.sp
.RS 2
Note that \fBmemcached\fR was designed for speed
and not for security. There is no authentication of requests that go in to
the memcached servers, and communication is not encrypted. The network that
your memcached servers and clients run within should be safe-guarded against
network attacks.
.RE
.SH SEE ALSO
.sp
.LP
\fBlibmemcached(3libmemcached)\fR
.LP
Additional documentation (FAQ) can be found at http://www.eu.socialtext.net/memcached/index.cgi\&.
.SH NOTES
.sp
.LP
LICENSE
.sp
.LP
The \fBmemcached\fR daemon is copyright Danga Interactive
and is distributed under  the BSD license. \fBmemcached\fR clients
are licensed separately.
